package com.anasoft.os.s4j.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.junit.runner.notification.RunListener;

import com.anasoft.os.s4j.ErrorReportingListener;

/**
 * Describes the error reporting configuration in relation
 * to failed tests.
 * 
 * @see SeleniumSession
 * @see ErrorReportingListener
 * 
 * @author vojtech.szocs
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
@Inherited
public @interface ErrorReporting {

    /**
     * Is the error reporting enabled?
     */
    boolean enabled();
    
    /**
     * Directory into which output files will be generated
     * by Selenium server.
     * <p>
     * <em>The value must always end with the path separator.</em>
     */
    String serverOutputDirectory() default "selenium/";
    
    /**
     * Directory into which output files will be generated
     * by test runners.
     * <p>
     * <em>The value must always end with the path separator.</em>
     */
    String runnerOutputDirectory() default "selenium/";
    
    /**
     * If an {@link Exception} occurs during error reporting
     * {@link RunListener listener} execution, it can't fall
     * through because this would essentially disable the
     * listener for subsequent tests.
     * <p>
     * If set to <tt>true</tt>, all exceptions are silently
     * ignored during listener execution.
     * <p>
     * If set to <tt>false</tt>, an {@link Error} will be logged
     * to the console (this has no effect on JUnit assertion
     * messages).
     */
    boolean swallowExceptions() default true;
    
    /**
     * Capture screenshots for failed tests?
     * <p>
     * Screenshots are physically stored by Selenium server.
     */
    boolean captureScreenshots() default true;
    
    /**
     * Retrieve recent Selenium server logs for failed tests?
     * <p>
     * Server logs are physically stored by test runners.
     */
    boolean retrieveLastRemoteControlLogs() default false;
    
}
